clearvars -except Globaloption option

if exist('Globaloption', 'var') == 0
    Globaloption.savefig = 1;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This code reads in the VAR dynamics and produce the Campbell-Shiller decomposition in the paper
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Load data

loaddata_4CIjoint_annual;
ttime = [startdate:enddate];

if option.robust == 1
    output_rp = 0.03;

elseif option.robust == 2
    output_rp = 0.02;

end

%% Estimation
run ../../tools/cs_estimation;

%% steady-state upper bound calculation
upper = exp(pxbar) * (mean(taxrevgdp - spendgdp));

gdpreturn = output_rp + y0nom_1 + yspr0 - pi0;

if option.robust==1
    output_rp = 0.03 ;
    save MAT/UKprepara_30.mat k0x k1x s upper pdX pxbar gdpreturn gdebt

    elseif option.robust==2
    output_rp = 0.02 ;
    save MAT/UKprepara_20.mat k0x k1x s upper pdX pxbar gdpreturn gdebt
end



